﻿frmCatalogRefresh =
{
	OnLoad : function ()
	{
		this.ddlMonitoredDirectory = document.getElementById ('ddlMonitoredDirectory');

		this.divUploadVerifyResults = document.getElementById ('divUploadVerifyResults');

		this.btnVerifyLoad = document.getElementById ('btnVerifyLoad');


		this.reqGetList = CreateXMLHttpRequest ("../Search/Search.ashx", "GetList", OnGetListComplete);

		this.reqGetImageCatalogsUploadExcelList = CreateXMLHttpRequest ("../Search/Search.ashx", "GetImageCatalogsUploadExcelList", this.OnVerifyResults);


		ClearList (this.ddlMonitoredDirectory, 'Cargando...');
		this.reqGetList.Call ({ pListName: "MonitoredDirectory" }, this.ddlMonitoredDirectory);
	},

	
	OnVerify : function ()
	{
		this.reqGetImageCatalogsUploadExcelList.Call ( { pMonitoredDirectoryID : this.ddlMonitoredDirectory.value }, this.divUploadVerifyResults );
	},


	OnVerifyResults : function (pResponse, pProcessingDurationms, pLocalParams)
	{
		var divUploadVerifyResults;


		alert (pResponse);


		divUploadVerifyResults.innerHTML = 
			Transform_XML_URLXSLT (
				xmlDoc, 
				"xslt/UploadVerifyResults.xslt",
			{	
				pClientProcessingDurationms : pProcessingDurationms
			});
			

		FixContentSizes ();
	},


	ddlMonitoredDirectory_OnChange : function ()
	{
		this.divUploadVerifyResults.innerHTML = '';
		
		if (this.ddlMonitoredDirectory.value == '')
		{
			this.btnVerifyLoad.disabled = 'disabled';
		}
		else
		{
			this.btnVerifyLoad.disabled = '';
		}
	}
};